<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
require_once 'database/notif_handler.php';
require_once 'database/profile_handler.php';

//get variabel disini
$usr_id = $_GET['usrid'];

$notif = new notif_handler();
$pr = new profile_handler();
//get notif
$notif->retr_notification($usr_id);

?>
<html>
<head>
    <link rel="stylesheet" href="style/style.css" />
</head>
    <body>
        <?php
       
            if ($notif->berita[0] != null){
        ?>
        <div id="notif_c">
           <?php
           //echo "aaaa";
           
            $jml = 0;
            
                for ($i=0; $i<count($notif->berita); $i++){
                    if ($notif->read[$i] == 0){
                        $jml++;
                    }
                }
                if ($jml > 0){
                    for ($i=0; $i<$jml; $i++){
                        if ($notif->berita[$i] == "tag"){
                            //link ke photo_id yg ditag
                            $pr->get_nama_lengkap($notif->sender[$i]);
                            $nama = $pr->result[0];
                             ?>
                            <a href="gallery.php?view=2&photo_id=<?php echo $notif->photo_id[$i]; ?>&firstview=1&notifid=<?php echo $notif->id[$i]?>" id="headerLink">
                            <?php
                            echo $nama. " tagged a photo of you. <br/>";
                        }
                        else if ($notif->berita[$i] == "follow"){
                            //link ke orang yg ngefollow
                             $pr->get_nama_lengkap($notif->sender[$i]);
                            $nama = $pr->result[0];
                            ?>
                            <a href="otherprofile.php?UserTujuan=<?php echo $notif->sender[$i]; ?>&firstview=1&notifid=<?php echo $notif->id[$i]?>" id="headerLink">
                            <?php
                            echo $nama. " has just followed you. </a><br/>";
                        }
                        else if ($notif->berita[$i] == "chat"){
                            //link ke orang yg ngefollow
                             $pr->get_nama_lengkap($notif->sender[$i]);
                            $nama = $pr->result[0];
                            ?>
                            <a href="chat.php?setgid=<?php echo $notif->photo_id[$i]; ?>&set=1&notifid=<?php echo $notif->id[$i]?>" id="headerLink">
                            <?php
                            echo $nama. " has invited you to chat. </a><br/>";
                        }
                    }
                }
            }
        
           ?>
        </div>
    </body>
</html>
